//引入路由组件
// import Home from '../pages/Home'
import Login from '../pages/Login'
import Register from '../pages/Register'
import Search from '../pages/Search'
import Detail from '../pages/Detail'
import AddCartSuccess from '../pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess'
import Center from '@/pages/Center'
import MyOrder from '@/pages/Center/myOrder'
import GroupOrder from '@/pages/Center/groupOrder'
export default  [
    {
        path: '/center',
        component: Center,
        meta: { isShowFooter: true },
        children:[
            {
                path:'myOrder',
                component:MyOrder
            },
            {
                path:'groupOrder',
                component:GroupOrder
            },
            {
                path:"/center",
                redirect:'myOrder'
            }
        ]
    },
    {
        path: '/home',
        component: ()=>import('../pages/Home'),
        meta: { isShowFooter: true }
    },
    {
        path: '/login',
        component: Login,
        meta: { isShowFooter: false }
    },
    {
        name: 'search',
        path: '/search/:keyword?',
        component: Search,
        meta: { isShowFooter: true }
    },
    {
        path: '/register',
        component: Register,
        meta: { isShowFooter: false }
    },
    {
        path: '/detail/:skuid',
        component: Detail,
        meta: { isShowFooter: true }
    },
    {
        name:'addcartsuccess',
        path:'/addcartsuccess',
        component:AddCartSuccess,
        meta: { isShowFooter: true }
    },
    {
        path:'/shopcart',
        component:ShopCart,
        meta:{isShowFooter:true}
    },
    {
        path:'/trade',
        component:Trade,
        meta:{isShowFooter:true},
        beforeEnter: (to, from, next) => {
            // ...
            if(from.path=='/shopcart'){
                next();
            }else{
                next(false);
            }
        }
    },
    {
        path:'/pay',
        component:Pay,
        meta:{isShowFooter:true},
        beforeEnter: (to, from, next) => {
            // ...
            if(from.path=='/trade'){
                next();
            }else{
                next(false)
            }
        }
    },
    {
        path:'/paysuccess',
        component:PaySuccess,
        meta:{isShowFooter:true},
    },
    {
        path: '*',
        redirect: '/home'
    }
]